public class Triangular_class {
    private double a;
    private double b;
    private double c;

    public Triangular_class(double a, double b, double c) {
        super();
        this.a = a;
        this.b = b;
        this.c = c;
    }


    public Triangular_class() {
        super();
        this.a=3;
        this.b=4;
        this.c=5;
    }

    double l=(a+b+c)/2.0;
    double num = l*(l-a)*(l-b)*(l-c);
    public double getArea() {
        double l=(a+b+c)/2.0;
        double num = l*(l-a)*(l-b)*(l-c);
        return Math.sqrt(num);
    }

    public double getPrimeter() {
        return a+b+c;
    }

    public String toString() {
        String s = "三角形[" + a + "," + b + "," + c + "]";
        return s;
    }

    public static void main(String[] args) {
        Triangular_class c1=new Triangular_class();
        System.out.println(c1);
        Triangular_class c2=new Triangular_class(6.0, 6.0, 6.0);
        if(c2.a+c2.b>c2.c && c2.a+c2.c>c2.b && c2.b+c2.c>c2.a)
        {
            System.out.print(c2.toString());
            System.out.print("面积"+c2.getArea());
            System.out.println("周长"+c2.getPrimeter());
        }
        else
            System.out.println("三角形不存在");
        if(c1.a+c1.b>c1.c && c1.a+c1.c>c1.b && c1.b+c1.c>c1.a)
        {
            System.out.print(c1.toString());
            System.out.print("面积"+c1.getArea());
            System.out.print("周长"+c1.getPrimeter());
        }
        else
            System.out.println("三角形不存在");

    }

}
